/////////////////////////////////////////////////////////////////////////////
// Copyright(c) 2012-2015 purang All Rights Reserved
// Name:        pr_base_impl.h
// Purpose:
// Author:      syy
// Modified by:
// Created:     2014/1/7 10:34
// RCS-ID:
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _PR_BASE_IMPL_H_
#define _PR_BASE_IMPL_H_

#include "../include/qb_base.h"
#include "core/system/scoped_refptr.h"
#include "qbnet/include/network_service.h"

#ifdef _MSC_VER
#include "qb_modules.h"
#else
#include "qb_modules_unix.h"
#endif

namespace qb {
class qbBaseImpl : public qbBase {
 public:
  qbBaseImpl();
  virtual ~qbBaseImpl();

  virtual int32_t init(const char* exepath);
  virtual int32_t terminate();

  int32_t QueryInterface(REFCLSID rclsid, REFIID riid, void** ppv);

 private:
  void CreateQbModule();
  void InitModule_NetworkService();
  void InitModule_MessageProcessor();
  void UnInitModule_NetworkService();
  void UnInitModule_MessageProcessor();
  void DestroyQbModule();

  scoped_refptr<INetworkService> getNetworkService();

 private:
  QbModules m_modules;
  volatile bool m_terminated = false;
};
}  // namespace qb

#endif  // _PR_BASE_IMPL_H_
